package eleven.senven.hpb.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.BitmapUtils;

import java.util.List;

import eleven.senven.hpb.R;
import eleven.senven.hpb.bean.SecondBean;

/**
 * Created by Administrator on 2015/7/13.
 */
public class SecondGridAdapter extends MyBaseAdapter<SecondBean.ResultEntity> {
    private BitmapUtils bitmapUtils;
    public SecondGridAdapter(List<SecondBean.ResultEntity> datas, Context context,BitmapUtils bitmapUtils) {
        super(datas, context);
        this.bitmapUtils=bitmapUtils;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView==null){
            convertView=inflater.inflate(R.layout.grid_item,null);
        }
        ImageView logo=ViewHolder.get(convertView,R.id.grid_logo);
        bitmapUtils.display(logo,datas.get(position).getTopic_cover());
        ImageView little=ViewHolder.get(convertView,R.id.grid_little);
        bitmapUtils.display(little,datas.get(position).getIcon());
        TextView content=ViewHolder.get(convertView,R.id.grid_content);
        content.setText(datas.get(position).getType_desc());
        return convertView;
    }
}
